package com.rany.day09.demo02;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class EntryTest {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("lin","wei");
        map.put("lu","yujie");
        map.put("gu","yongqiang");
        System.out.println(map);

        Set<Map.Entry<String, String>> entries = map.entrySet();
        Iterator<Map.Entry<String, String>> iterator = entries.iterator();
        while (iterator.hasNext()){
            Map.Entry<String, String> next = iterator.next();
            String key = next.getKey();
            System.out.println(key);
        }
        System.out.println("=========");
        for (Map.Entry<String, String> entry : entries) {
            String key = entry.getKey();
            System.out.println(key);
        }
    }
}
